<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <hello></hello>
        <hello></hello>
        <hello></hello>
        <hello></hello>
        <hello></hello>
        <hello></hello>

    </div>
    <script>

        //2.创建全局组件，当前应用中该组件是一个子组件
        Vue.component('hello',{
            template:"<div>春眠不觉晓{{next}}<button @click='jixu'>按一下</button></button></div>",
            data() {
                return {
                    next: '处处蚊子咬',
                };
            },methods: {
                jixu(){
                    this.next = this.next + "夜来大狗熊吓得到处跑"
                }
            }
        });

        //1.创建Vue实例，该实例也是一个组件，是全局父组件
        const vm = new Vue({
            el:"#app"
        })

    </script>
</body>
</html>